package com.keqiang.chart.impl.radar.impl

import android.graphics.Canvas
import android.graphics.Paint
import com.keqiang.chart.utils.ObjectPool

/**
 * 高亮绘制器，基于数据点绘制一个圆
 *
 * @author Created by wanggaowan on 2022/10/31 10:16
 */
open class RadarChartHighLightRender @JvmOverloads constructor(
    chart: RadarChart,
    /**
     * 遮罩颜色
     */
    val maskColor: Int = 0x33ffffff,
    /**
     * 基于[RadarEntity.indicatorSize]的倍率，用作遮罩圆的半径
     */
    val radiusPercent: Float = 1.5f) : HighLightRender(chart) {

    override fun onDraw(canvas: Canvas, data: RadarEntity) {
        val paint = ObjectPool.obtainPaint<Paint>()
        paint.color = maskColor
        canvas.drawCircle(data.drawRectF.left, data.drawRectF.top, data.indicatorSize * radiusPercent, paint)
        ObjectPool.recyclePaint(paint)
    }
}